home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16324 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  37 lines

  1. Newsgroups: comp.lang.c++,comp.lang.c,comp.os.ms-windows.programmer.misc
  2. Path: uu4news.netcom.com!friend!news
  3. From: rich@kastle.com (Richard Krehbiel)
  4. Subject: Re: fastest code
  5. Message-ID: <1996Apr10.110121.6784@friend.kastle.com>
  6. Sender: news@friend.kastle.com (News)
  7. Reply-To: rich@kastle.com
  8. Organization: Kastle Development Associates
  9. X-Newsreader: Forte Free Agent 1.0.82
  10. References: <316112A2.7D37@public.sta.net.cn> <4k1sntINNdd6@keats.ugrad.cs.ubc.ca> <3165a356.105975604@204.248.25.97> <4k4ll5$fq@solutions.solon.com> <4ke5v6$17k@samba.rahul.net>
  11. Date: Wed, 10 Apr 1996 12:02:13 GMT
  12.  
  13. Oliver Hellwig <hellwig@rahul.net> wrote:
  14.  
  15. >  Just a few days ago I used Watcom 10.5 to
  16. >compile the Linux NE2000 driver and I had to track down a bug
  17. >were the watcom compiler optimized away some critical code.
  18. >The code in question looked like this:
  19.  
  20. >         for (i=0; i<16; i++)
  21. >             prom[i] = prom[i+i];
  22.  
  23. >The output of the compiler left the loop but removed the 
  24. >assignment!  Disabling optimizations will make it compile
  25. >correctly as will using pointers.  However, this
  26. >bug greatly dampened my enthusiasm for Watcom C.
  27.  
  28. I suspect a proper "volatile" declaration on "prom" might have fixed
  29. this, i.e. if "prom" is currently declared "char prom[16]" then it
  30. should be declared "volatile char prom[16]".  I would not consider
  31. this an optimizer bug in Watcom.
  32.  
  33. --
  34. Richard Krehbiel, Kastle Systems, Arlington VA USA
  35. rich@kastle.com (work) or richk@mnsinc.com (personal)
  36.  
  37.